#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int getLuckyBag(const vector<int>& v, int pos, int sum, int mul)
{
	int count = 0;
	for (int i = pos; i < v.size(); i++)
	{
		sum += v[i];
		mul *= v[i];
		if (sum > mul) //只有数据有1的时候才可能sum>mul
			count += 1 + getLuckyBag(v, i + 1, sum, mul);
		else if (v[i] == 1) // 如果不幸运，并且当前值为1(数据只有1才会这样)
			count += getLuckyBag(v, i + 1, sum, mul);
		else
			break;
		sum -= v[i];
		mul /= v[i];
		while (i < v.size() - 1 && v[i] == v[i + 1])
		{	// 处理重复问题
			i++;
		}
	}
	return count;
}
 
int main()
{
	int n = 0;
	cin >> n;
	vector<int> v;
	v.reserve(n);
	for (int i = 0;i < n;i++)
	{
		int j = 0;
		cin >> j;
		v.push_back(j);
	}
	sort(v.begin(), v.end());
	cout << getLuckyBag(v, 0, 0, 1);
}